<template>
  <div class="app">
    <van-nav-bar
      title="影院详情"
      left-arrow
      fixed
      placeholder
      z-index="999"
      @click-left="$router.back()"
    />
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="item in shopInfo.img" >
       <img :src="item" alt="">
      </van-swipe-item>
    </van-swipe>
    <div class="my-btn">
      <a class="one-btn" :href="'tel://'+shopInfo.tel">拨打电话</a>
      <span class="two-btn" @click="$router.back()">影城购票</span>
    </div>
    <div class="add">
      <ul>
        <li>
         <svg class="xl-icon location" aria-hidden="true">
          <use xlink:href="#icon-dingwei"></use>
        </svg>
          <span class="one-add">{{shopInfo.name}}</span>
        </li>
        <li>
          <span
            >地址：{{shopInfo.address}}</span
          >
        </li>
        <li>
          <span>影城电话：{{shopInfo.tel}}</span>
        </li>
      </ul>
    </div>
    <div class="map" id="map">
      <!-- <img src="../assets/地图.webp" alt=""> -->
      
    </div>
  </div>
</template>

<script>

import { Swipe, SwipeItem } from "vant";
export default {
  data() {
    return {

      shopInfo:{}
    };
  },
  components:{
     [Swipe.name]:Swipe,
     [SwipeItem.name]:SwipeItem
  },
  created() {
     let {shopInfo} = localStorage;
      this.shopInfo = shopInfo&&JSON.parse(shopInfo)

  },
  mounted() {

    this.mapInit()

  },
  methods: {
     
     mapInit(){
       var map = new BMapGL.Map('map'); //  new 实例

       let {pos} = this.shopInfo;

       let [lng,lat] = pos.split(',')
       lng = +lng;
       lat = +lat;

          //  让地图以传递的坐标点居中 
          //  19  20  
        map.centerAndZoom(new BMapGL.Point(lng, lat), 15);
        map.enableScrollWheelZoom(true);
        // // 创建点标记
        var marker1 = new BMapGL.Marker(new BMapGL.Point(lng, lat));
     
        // 在地图上添加点标记
        map.addOverlay(marker1);
    
     }


  },
};
</script>

<style scoped lang="less">

.app{
    overflow: hidden;
  .my-swipe .van-swipe-item {
  color: #fff;

}
.my-btn {
  width: 100%;
  height: 50px;
  display: flex;
  flex-direction: row;
  .one-btn {
    width: 50%;
    height: 46px;
    border: 2px solid red;
    color: red;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .two-btn {
    width: 50%;
    height: 50px;
    background: red;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
.add {
  li {
    display: block;
    list-style-type: none;
    margin: 10px;
  }
  .iconfont {
    font-size: 17px;
  }
  .one-add {
    margin-left: 10px !important;
    font-size: 17px !important;
    color: #000 !important;
  }
  span {
    color: grey;
    font-size: 13px;
  }
}
.map{
   width: 100%;
    height:230px;
    margin-top: 20px;
}
}
</style>
